import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

function route(path, file, name, children) {

  // const comp =   require(`../pages${file}`);

  return {
    exact: true,
    path,
    name,
    children,
    component: () => import('../pages' + file)
  }
}

export default new Router({
  routes: [
    route("/login", "/Login", "Login"),
    {
      path: "/", // 根路径，路由到 Layout组件
      component: () => import('../pages/Layout'),
      redirect: "/index/dashboard",
      children: [ // 其它所有组件都是 Layout的子组件

        route("/index/dashboard", "/Dashboard", "Dashboard"),
        route("/item/list", '/item/Goods', "Goods"),
        route("/item/adjust", '/item/GoodsAdjust', "Adjust"),
        route("/item/page1", '/item/GoodsAdjust', "Adjust1"),
        route("/item/page2", '/item/GoodsAdjust', "Adjust2"),
        route("/item/pagehis", '/item/GoodsAdjust', "Adjusthis"),

        route("/user/user", '/user/User', "User"),
        route("/user/role", '/user/Role', "Role"),
        route("/user/info", '/user/Info', "Info"),
        route("/driver/driver", '/driver/Driver', "driver"),
        route("/trade/promotion", '/trade/Promotion', "Promotion"),
        route("/path/list", "/path/Path", "path"),
        route("/sale/salelist", "/trade/Order", "trade"),
        route("/sale/returnlist", "/trade/ReturnOrder", "return"),
        route("/sale/wflist", "/trade/Wfcx", "return"),
        route("/purchase/list", "/purchase/Purchase", "Purchase"),
        route("/purchase/purchase1", "/purchase/Purchase1", "Purchase1"),
        route("/purchase/purchase2", "/purchase/Purchase1", "Purchase2"),
        route("/purchase/purchase3", "/purchase/Purchase1", "Purchase3"),

        route("/returnfactory/list", "/returnfactory/Return", "returnfactory"),
        route("/returnfactory/fac1", "/returnfactory/Return1", "returnfactory1"),
        route("/returnfactory/fac2", "/returnfactory/Return1", "returnfactory2"),
        route("/returnfactory/fac3", "/returnfactory/Return1", "returnfactory3"),

        route("/ps/list", "/logistics/Logistics", "ps"),
        route("/ps/his", "/logistics/Logistics", "pshis"),
        route("/ps/psrkhis", "/logistics/Logistics", 'psrkhis'),
        route("/ps/psck", "/logistics/LogisticsOut", 'psck'),
        route("/ps/wdrk", "/logistics/LogisticsIn", 'wdrk'),
        route("/pssd/list", "/logistics/LogisticsArrival", 'pssd'),
        route("/tp/list", "/restitute/Restitute", "tp"),
        route("/tp/tprk", "/restitute/RestituteIn", "tprk"),
        route("/tp/his", "/restitute/Restitute", "tphis"),
        route("/tp/rkhis", "/restitute/Restitute", "rkhis"),
        route("/tp/tpfc", "/restitute/RestituteEmit", "tpfc"),
        route("/tpdh/tpdh", "/restitute/RestituteArrival", "tpdh"),
        route("/category/list", "/category/Category", "category"),
        route("/storage/list", "/storage/Storage", "storage"),
        route("/transfer/list", "/transfer/Transfer", "transfer"),
        route("/transfer/page1", "/transfer/Transfer1", "transfer1"),
        route("/transfer/page2", "/transfer/Transfer2", "transfer2"),
        route("/transfer/page3", "/transfer/Transfer3", "transfer3"),
        route("/transfer/page4", "/transfer/Transfer3", "transfer4"),
        route("/report/plbb", "/report/CateStockReport", "bb1"),
        route("/report/ppbb", "/report/BrandStockReport", "bb2"),
        route("/report/xsbb", "/report/OrderReport", "bb3"),
        route("/report/thbb", "/report/OrderReturnReport", "bb4"),
        route("/report/kcbb", "/report/KucnRtReport", 'bb5'),
        route("/report/hiskcbb", "/report/KucnReport", 'bb6'),
        route("/bcancel/xscx", "/bcancel/Xscx", 'cancel1'),
        route("/bcancel/thcx", "/bcancel/Thcx", 'cancel2'),
        route("/bcancel/wfcx", "/bcancel/Wfcx", 'cancel3'),

        route("/wf/list", "/wangfan/Exchange", 'wf1'),
        route("/wf/wfsd", "/wangfan/ExchangeArrival", 'wf2'),
        route("/wf/wffc", "/wangfan/ExchangeEmit", 'wf3'),
        route("/wf/wfrk", "/wangfan/ExchangeIn", 'wf4'),
        route("/wf/wfhis", "/wangfan/Exchange", 'wf5'),
        route("/wf/wfrkhis", "/wangfan/ExchangeIn", 'wf6'),



        // route("/*","/404","/404") //待开发
        // route("/item/brand",'/item/Brand',"Brand"),

      ]
    },
    route("/register", "/Register", "Register"),
  ]
})
